<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<title>MIS</title>
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="stylesheet" type="text/css"
	href="../../lib/bootstrap/css/bootstrap.css">
<link rel="stylesheet" type="text/css"
	href="../../stylesheets/theme.css">
<link rel="stylesheet"
	href="../../lib/font-awesome/css/font-awesome.css">

<script src="../../lib/jquery.min.js" type="text/javascript"></script>
<script src="../../lib/bootstrap/js/bootstrap.js"></script>
<script src="../../lib/jquery.validate.min.js"></script>
<script src="../../lib/jquery.cookie.js"></script>
<script src="../../lib/jquery.messager.js"></script>
<script src="../../js/init.js"></script>

<link rel="stylesheet" href="//apps.bdimg.com/libs/jqueryui/1.10.4/css/jquery-ui.min.css">
<script src="//apps.bdimg.com/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="//apps.bdimg.com/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>

<!-- <script src="../../lib/jquery.min.js" type="text/javascript"></script>
<script src="../../lib/bootstrap/js/bootstrap.js"></script>
<script src="../../lib/jquery.validate.min.js"></script>
<script src="../../lib/jquery.cookie.js"></script>
<script src="../../lib/jquery.messager.js"></script>
<script src="../../js/init.js"></script> -->

<style type="text/css">
#dialog{
	top:20%;
	left:30%;
	width:350px;
	height:200px; 
	background-color:#FCFCFC;
	border: 1px solid #ccc;
	-moz-border-radius: 10px;
	-webkit-border-radius: 10px;
	position:absolute;
	display:none;
}

</style>

</head>
<!--[if (gt IE 9)|!(IE)]><!-->

<body class="">
	<!--<![endif]-->

	<div class="navbar"></div>
	<div class="common"></div>


	<div class="sidebar-nav"></div>

	<div class="content">
		<div class="well">
			<ul class="nav nav-tabs">
				<li class="active"><a href="#userlist" data-toggle="tab">简历列表</a></li>
			</ul>
			 
			<div id="myTabContent" class="tab-content">
				<div class="tab-pane active in" id="userlist">
					<div class="btn-toolbar">
						<form class="form-inline ">
						<div  id="dialog"> 
							<table style="margin: 10px auto auto auto;">
								<tr style="height:30px;text-align: left">
									<th style="font-size:30px"><label class="control-label">修改状态</label>
									</th>
								</tr>
								<tr style="text-align: center;vertical-align: top">
									<td>
										<label class="control-label">面试时间</label>
									</td>
									<td>
										<input type="text" id="interviewTime"  placeholder="MM/dd/yyyy">
									</td>
								</tr>
								<tr style=" text-align: center;vertical-align: top">
									<td>
										<label class="control-label">简历状态</label>
									</td>
									<td>
										<select name="updateStatus" id="updateStatus">
											<option value='－1'>请选择</option>
											<option value='0'>申请</option>
											<option value='1'>已查看</option>
											<option value='2'>通知面试</option>
											<option value='3'>已面试</option>
											<option value='4'>签约上岗</option>
											<option value='5'>已上班</option>
											<option value='6'>婉言拒绝</option>
											<option value='7'>不合适</option>
										</select>
									</td>
								</tr>
								<tr style="text-align: right">
									<td>
										<button id="btn-close" type="button" class="btn">关闭</button>
										<button id="btn-update" type="button" class="btn" onclick="updatePPost()">提交</button>
									</td>
								</tr>
							</table>
			 				 
			 		    </div>
							<div class="row">
								<input type="hidden" id="p_p_id_hidden"></input>
								<input type="hidden" id="postFlag_hidden"></input>
								<div class="input-prepend input-append span2">
									<span class="add-on">每页</span> <input id="list_page_size"
										class="input-mini" type="text" value="15"> <span
										class="add-on">条</span>
								</div>

								<div class="input-prepend input-append span2">
									<span class="add-on">第</span> <input id="list_page"
										class="input-mini" type="text" value="1"> <span
										class="add-on">页</span>
								</div>


								<div class="span2 input-append btn-group">
									<button type="button" class="btn" id="btn_jump">跳转</button>
									<button type="button" class="btn" id="btn_prev">上一页</button>
									<button type="button" class="btn" id="btn_next">下一页</button>
								</div>

							</div>
						</form>
					</div>

					<div class="control-group">
						<label class="control-label">总数</label> <label id="total"></label>
						<input type="hidden" id="postId">
						<input type="hidden" id="postFlag">
					</div>
					<div class="well" id="loadimgdiv">
						<table class="table">
							<thead>
								<tr>
									<th>ID</th>
									<th>姓名</th>
									<th>生成时间</th>
									<th>面试时间</th>
									<th>当前状态</th>
									<th>来源</th>
								</tr>
							</thead>
							<tbody id="user_tabel">

							</tbody>
						</table>
					</div>
					
					
				</div>
			</div>
		</div>
	</div>

	<script type="text/javascript">
	

		$(function() {
			initAdminNavBar();
			initCommon();
			initSideBar('user-management', 'company-list');
			$("#admissionDate").datepicker();
			$("#list_page_size").html(15);
			$("#list_page").html(1);
			reloadtable();

			$('#btn_jump').on('click', function(e) {
				reloadtable();
			});

			$('#btn_next').on('click', function(e) {
				var curpage = $('#list_page').val();
				$('#list_page').val(parseInt(curpage) + 1);
				reloadtable();
			});

			$('#btn_prev').on('click', function(e) {
				var curpage = $('#list_page').val();
				if (parseInt(curpage) > 1) {
					$('#list_page').val(parseInt(curpage) - 1);
					reloadtable();
				}
			});
			
			$('#btn-close').on('click', function(e) {
				$("#dialog").css('display','none'); 
			});

		});

		function reloadtable() {
			var postId = getparastr('postId');
			var postFlag = getparastr('postFlag');
			$('#postId').val(postId)
			$('#postFlag').val(postFlag)
			var pageSize = $('#list_page_size').val();
			var curPage = $('#list_page').val();
			$.ajax({
						contentType : "application/json",
						url : api_base_url + "selectPPostList.json?"
								+ "pageSize=" + pageSize + "&curPage="
								+ curPage + "&postId="
								+ postId + "&postFlag="
								+ postFlag,
						dataType : "json",
						type : "get",
						success : function(data) {
							//alert(data);
							if (data.code == "200") {
								$('#list_page').html(pageSize)
								//refresh grid
								var rows = '';

								for (var int = 0; int < data.responseData.length; int++) {
									rows += "<tr>";
									rows += "<td>"
											+ data.responseData[int].p_p_id
											+ "</td>";
									rows += "<td>"
											+ data.responseData[int].personName
											+ "</td>";
									rows += "<td>"
											+ data.responseData[int].createTime
											+ "</td>";
									rows += "<td>"
											+ data.responseData[int].internshipTime
											+ "</td>";
									rows += "<td>"
											+ data.responseData[int].status
											+ "</td>";
									rows += "<td>"
											+ data.responseData[int].source
											+ "</td>";
									rows += "<td><button  type='button' onclick='updatePPost_pre("
											+ data.responseData[int].p_p_id 
											+ ",postFlag=" + postFlag
											+ ")' class='btn btn-success'>更新</button></td>";
									rows += "</tr>";
								}

								$('#user_tabel').html(rows);
								$('#list_cur_page').text(curPage);
							}
							$.messager.anim('fade', 1000);
						    $.messager.show('操作提示',data.msg, 5000);
						}
					});
		}
		
		function updatePPost_pre(p_p_id, postFlag) {
			$('#p_p_id_hidden').val(p_p_id);
			$('#postFlag_hidden').val(postFlag);
			$("#dialog").css('display','block');
		}
		
		
		function updatePPost() {
			var p_p_id = $('#p_p_id_hidden').val();
			var postFlag = $('#postFlag_hidden').val();
			var updateStatus = $('#updateStatus').val();
			var interviewTime = $('#interviewTime').val();
			if (updateStatus != -1) {
				$.ajax({
					contentType : "application/json",
					url : api_base_url + "updatePPost.json?" + "p_p_id="
							+ p_p_id + "&postFlag=" + postFlag
							+ "&updateStatus=" + updateStatus
							+ "&interviewTime=" + interviewTime,
					dataType : "json",
					type : "get",
					success : function(data) {
						//alert(data);
						if (data.code == "200") {
							$("#dialog").css('display','none');
							reloadtable();
						}
						$.messager.anim('fade', 1000);
					    $.messager.show('操作提示',data.msg, 5000);
					}
				});
			}
		}
	</script>
</body>
</html>


